package adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import bean.PrePareOrReViewDetailBean;
import student.andlei.com.student.R;
import view.CircleImageView;

public class PrePareTaskCoursewareAdapter extends BaseQuickAdapter<PrePareOrReViewDetailBean.coursewareData,BaseViewHolder>{

    private Context context;
    public PrePareTaskCoursewareAdapter(Context context, int layoutResId, @Nullable List data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
        View convertView = layoutInflater.inflate(R.layout.item_cours_list, null, false); // if use parent, only first line will show up
        return super.onCreateViewHolder(parent, viewType);
    }

    @Override
    protected void convert(BaseViewHolder helper, PrePareOrReViewDetailBean.coursewareData item) {
        //课件类型 1:ppt 2:word 3:excel 4:图片 5:视频 6:其他
        helper.setText(R.id.tv_content,item.courseware_name);
        CircleImageView imageView =  helper.getView(R.id.cimg_curous);
        switch (item.courseware_type){
            case 1:
                imageView.setImageResource(R.mipmap.ppt);
                break;
            case 2:
                imageView.setImageResource(R.mipmap.word);
                break;
            case 3:
                imageView.setImageResource(R.mipmap.excel);
                break;
            case 4:
                imageView.setImageResource(R.mipmap.tupian);
                break;
            case 5:
                imageView.setImageResource(R.mipmap.shipin);
                break;
            case 6:
                imageView.setImageResource(R.mipmap.tupian);
                break;
            default:
                imageView.setImageResource(R.mipmap.tupian);
                break;
        }
    }


}
